
package ch.hearc.coursJava.exa2;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;

public class MyString implements Serializable
	{

	/**
     * 
     */
    private static final long serialVersionUID = 2611630952171713791L;

    /*------------------------------------------------------------------*\
	|*							Constructeurs							*|
	\*------------------------------------------------------------------*/
	public MyString(String str)
		{
		this.str = str;
		}

	/*------------------------------------------------------------------*\
	|*							Methodes Public							*|
	\*------------------------------------------------------------------*/
	@Override
	public String toString()
		{
		return this.str;
		}

	/*------------------------------------------------------------------*\
	|*							Methodes Private						*|
	\*------------------------------------------------------------------*/
	private String crypter(String str)
		{
		return str;
		}

	private String decrypter(String strCrypte)
		{
		return strCrypte;
		}

	/*------------------------------*\
	|*		Serialisation			*|
	\*------------------------------*/
	private void writeObject(ObjectOutputStream out) throws IOException
		{
		out.writeObject(crypter(this.str));
		}

	private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
		{
		String str = (String)in.readObject();
		this.str = decrypter(str);
		}

	/*------------------------------------------------------------------*\
	|*							Attributs Private						*|
	\*------------------------------------------------------------------*/
	private String str;
	}

